# -*- coding: UTF-8 -*-
#coding=utf-8
import os
#遍历整个目录获取所有的文件的绝对路径
def travelDir(dirName):
    i = 0
    fileAllNames = []
    if os.path.isdir(dirName):  
        for root, dirs, files in os.walk(dirName):
            for filename in files:
                fileAllName=root+'\\'+filename
                fileAllNames.insert(i,fileAllName)
    return fileAllNames

#fileNameExtArr是允许通过的扩展名字符串数组
def filter(fileAllNamesArr, fileNameExtArr):
    fileAllNames = []
    i = 0
    for fileAllName in fileAllNamesArr:
        for ext in fileNameExtArr:
            if(os.path.splitext(fileAllName)[1] == ext):
                fileAllNames.insert(i,fileAllName)
                ++i
                break
    return fileAllNames